package com.yr.ryjk.pay.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import com.yr.ryjk.pay.entity.BankCard;

public interface BankCardMapper {
    int deleteByPrimaryKey(String cardId);

    int insert(BankCard record);

    int insertSelective(BankCard record);

    BankCard selectByPrimaryKey(String cardId);

    int updateByPrimaryKeySelective(BankCard record);

    int updateByPrimaryKey(BankCard record);

    @Select("select * from bank_card where doc_id=(select id from doctor where phone=#{0})")
    @ResultMap("BaseResultMap")
	List<BankCard> selectByDocPhone(String phone);

    @Select("select * from bank_card where card_no=#{0}")
    @ResultMap("BaseResultMap")
	BankCard selectByCardNo(String cardNo);

    @Delete("delete from bank_card where card_id=#{0} and doc_id=(select id from doctor where phone=#{1})")
	void deleteByIdAndDocPhone(String cardId, String phone);
}